package cisdi.mes.sm.rm.daoImpl;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import cisdi.mes.sm.rm.dao.MatRequestDao;
import cisdi.mes.sm.rm.domain.SmRmMaterialRequest;

@Repository
public class MatRequestDaoImpl extends HibernateDaoSupport implements MatRequestDao{

	@Autowired
	public void setMySessionFactory(SessionFactory sessionFactory){
		super.setSessionFactory(sessionFactory);
	}
	
	@Override
	public SmRmMaterialRequest getByReqId(String reqId) {
		String hql = "from SmRmMaterialRequest t where t.reqId=?";
		return (SmRmMaterialRequest)this.getHibernateTemplate().find(hql, reqId).get(0);
	}

}
